<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
                             "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:rich="http://richfaces.org/rich"
                template="layout/template.xhtml">
                       
<ui:define name="body">
    
    <h:messages globalOnly="true" styleClass="message" errorClass="errormsg" infoClass="infomsg" warnClass="warnmsg" id="globalMessages"/>
    
    <rich:panel>
        <f:facet name="header">Facility</f:facet>



        <s:decorate id="address" template="layout/display.xhtml">
            <ui:define name="label">address</ui:define>
            #{facilityHome.instance.address}
        </s:decorate>


        <s:decorate id="city" template="layout/display.xhtml">
            <ui:define name="label">city</ui:define>
            #{facilityHome.instance.city}
        </s:decorate>


        <s:decorate id="country" template="layout/display.xhtml">
            <ui:define name="label">country</ui:define>
            #{facilityHome.instance.country}
        </s:decorate>


        <s:decorate id="county" template="layout/display.xhtml">
            <ui:define name="label">county</ui:define>
            #{facilityHome.instance.county}
        </s:decorate>


        <s:decorate id="description" template="layout/display.xhtml">
            <ui:define name="label">description</ui:define>
            #{facilityHome.instance.description}
        </s:decorate>


        <s:decorate id="name" template="layout/display.xhtml">
            <ui:define name="label">name</ui:define>
            #{facilityHome.instance.name}
        </s:decorate>


        <s:decorate id="phone" template="layout/display.xhtml">
            <ui:define name="label">phone</ui:define>
            #{facilityHome.instance.phone}
        </s:decorate>


        <s:decorate id="priceRange" template="layout/display.xhtml">
            <ui:define name="label">priceRange</ui:define>
            #{facilityHome.instance.priceRange}
        </s:decorate>


        <s:decorate id="state" template="layout/display.xhtml">
            <ui:define name="label">state</ui:define>
            #{facilityHome.instance.state}
        </s:decorate>


        <s:decorate id="type" template="layout/display.xhtml">
            <ui:define name="label">type</ui:define>
            #{facilityHome.instance.type}
        </s:decorate>


        <s:decorate id="uri" template="layout/display.xhtml">
            <ui:define name="label">uri</ui:define>
            #{facilityHome.instance.uri}
        </s:decorate>


        <s:decorate id="zip" template="layout/display.xhtml">
            <ui:define name="label">zip</ui:define>
            #{facilityHome.instance.zip}
        </s:decorate>

        <div style="clear:both"/>
        
    </rich:panel>
    
    <div class="actionButtons">      

        <s:button view="/FacilityEdit.xhtml" 
                    id="edit" 
                 value="Edit"/>

        <s:button view="/#{empty facilityFrom ? 'FacilityList' : facilityFrom}.xhtml"
                    id="done"
                 value="Done"/>

    </div>

    <rich:tabPanel switchType="ajax">

    <rich:tab label="courses">
    <div class="association" id="coursesChildren">
        
        <h:outputText value="There are no courses associated with this facility."
                   rendered="#{empty facilityHome.courses}"/>
        
        <rich:dataTable value="#{facilityHome.courses}" 
                       var="course" 
                  rendered="#{not empty facilityHome.courses}" 
                rowClasses="rvgRowOne,rvgRowTwo"
                        id="coursesTable">
            <h:column>
                <f:facet name="header">id</f:facet>
                <h:outputText value="#{course.id}"/>
            </h:column>
            <ui:remove>
            <h:column>
                <f:facet name="header">description</f:facet>
                <h:outputText value="#{course.description}"/>
            </h:column>
            </ui:remove>
            <h:column>
                <f:facet name="header">designer</f:facet>
                <h:outputText value="#{course.designer}"/>
            </h:column>
            <h:column>
                <f:facet name="header">fairways</f:facet>
                <h:outputText value="#{course.fairways}"/>
            </h:column>
            <h:column>
                <f:facet name="header">greens</f:facet>
                <h:outputText value="#{course.greens}"/>
            </h:column>
            <h:column>
                <f:facet name="header">name</f:facet>
                <h:outputText value="#{course.name}"/>
            </h:column>
            <h:column>
                <f:facet name="header">numHoles</f:facet>
                <h:outputText value="#{course.numHoles}"/>
            </h:column>
            <h:column>
                <f:facet name="header">signatureHole</f:facet>
                <h:outputText value="#{course.signatureHole}"/>
            </h:column>
            <h:column>
                <f:facet name="header">yearBuilt</f:facet>
                <h:outputText value="#{course.yearBuilt}"/>
            </h:column>
            <h:column>
                <f:facet name="header">action</f:facet>
                <s:link id="selectcourse" 
                     value="View" 
                      view="/Course.xhtml">
                    <f:param name="courseId" 
                            value="#{course.id}"/>
                    <f:param name="courseFrom" value="Facility"/>
                </s:link>
            </h:column>
        </rich:dataTable>
        
    </div>
    
    <div class="actionButtons">
        <s:button 
               value="Add course"
                view="/CourseEdit.xhtml">
            <f:param name="facilityId" 
                    value="#{facilityHome.instance.id}"/>
            <f:param name="courseFrom" value="Facility"/>
        </s:button>
    </div>        
    </rich:tab>
</rich:tabPanel>
</ui:define>

</ui:composition>
